<?php if (!defined('THINK_PATH')) exit(); /*a:2:{s:84:"D:\www\photo_album_bless\public_html/../application/wxapplet\view\manager\index.html";i:1544144729;s:69:"D:\www\photo_album_bless\application\wxapplet\view\shared\layout.html";i:1544144729;}*/ ?>
<!DOCTYPE html>
<html>


<!-- Mirrored from www.zi-han.net/theme/hplus/ by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 20 Jan 2016 14:16:41 GMT -->
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="renderer" content="webkit">
    <meta http-equiv="Cache-Control" content="no-siteapp">
    <title>小程序管理</title>

    <!--[if lt IE 9]>
    <meta http-equiv="refresh" content="0;ie.html" />
    <![endif]-->

    <link rel="stylesheet" href="/static/plugins/bootstrap-3.3.7/css/bootstrap.min.css">
    <link rel="stylesheet" href="/static/plugins/font-awesome-4.7.0/css/font-awesome.min.css">
    <link rel="stylesheet" href="/static/sys/css/style.min.css">
    <link rel="stylesheet" href="/static/plugins/bootstrap-table/bootstrap-table.css">
    <link rel="stylesheet" href="/static/plugins/dataTables/dataTables.bootstrap.css">
    <link rel="stylesheet" href="/static/plugins/layui/css/layui.css">
    
    <script src="/static/plugins/jquery-1.12.4/jquery-1.12.4.min.js"></script>
    <script src="/static/plugins/bootstrap-3.3.7/js/bootstrap.min.js"></script>
    <script src="/static/plugins/bootstrap-table/bootstrap-table.min.js"></script>
    <script src="/static/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>
    <script src="/static/plugins/layui/layui.js"></script>
    <style>
        .text-red{color:red;}
        .text-green{color:#17bb46;}
        .text-orange{color:orange;}
        .text-yellow{color:#c7cd2f;}
        .text-blue{color:#0bb8c8;}
        .fixed-table-toolbar .bars, .fixed-table-toolbar .columns, .fixed-table-toolbar .search{margin-top:-45px;}
        .th-inner{color:#555;}
    </style>
    
</head>

<body class="gray-bg">
    
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-content">
                    <div class="row">
                        <div class="col-sm-2 m-b-xs">
                            <span>
                                <button type="button" class="btn btn-primary btn-sm" id="btnAdd"><i class="glyphicon glyphicon-plus"></i> 新增</button>
                            </span>
                        </div>
                        <div class="col-sm-2 col-sm-offset-7">
                            <div class="input-group">
                                <span class="input-group-btn">
                                    <input type="text" placeholder="请输入奖项名称关键字查询" class="input-sm form-control" id="keyword" name="keyword">
                                    <button type="button" class="btn btn-sm btn-primary" id="search">搜索</button>
                                </span>
                            </div>
                        </div>
                        <span id="refresh" class="fa fa-refresh fa-spin" title="刷新" onclick="javascript:$('#tb').bootstrapTable('refresh')"></span>
                    </div>
                    <table data-toggle="table" id="tb" data-pagination="true" style="overflow:auto">
                        <thead>
                            <tr>
                                <th data-align="center" data-field="id" data-sortable="true">编号</th>                                
                                <th data-align="center" data-field="name">小程序名称</th>
                                <th data-align="center" data-field="original_id">小程序OriginalId</th>
                                <th data-align="center" data-field="isjump" data-formatter="stateFormat">自动跳转</th>
                                <th data-align="center" data-field="app_id" data-sortable="true">跳转目标AppId</th>
                                <th data-align="center" data-field="jump_url">跳转地址</th>
                                <th data-align="center" data-field="isshow" data-sortable="true" data-formatter="stateFormat">显示审核壳</th>
                                <th data-align="center" data-field="isshowback" data-sortable="true" data-formatter="stateFormat">显示审核壳(备用)</th>
                                <th data-align="center" data-formatter="operateFormatter">操作</th>
                            </tr>
                        </thead>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>

</body>
    
    <script>
        function initTable() {
            //先销毁表格
            $('#tb').bootstrapTable('destroy');
            //初始化表格,动态从服务器加载数据
            $("#tb").bootstrapTable({
                method: "Post",  //使用Post请求到服务器获取数据
                url: "<?php echo url('manager/getList'); ?>", //获取数据的Servlet地址
                striped: true,  //表格显示条纹
                pagination: true, //启动分页
                pageSize: 15,  //每页显示的记录数
                pageNumber: 1, //当前第几页
                pageList: [15, 30],  //记录数可选列表
                search: false,  //是否启用查询
                sortable: true, //是否启用排序
                sortOrder: "asc", //排序方式                
                sidePagination: "server", //表示服务端请求                
                queryParamsType: "limit",
                contentType: "application/x-www-form-urlencoded",
                queryParams: function queryParams(params) {   //设置查询参数
                    var param = {
                        limit: params.limit,
                        offset: params.offset,
                        sortName: params.sort,
                        sortOrder: params.order,                        
                        keyword: $("input[name=keyword]").val()                        
                    };
                    return param;
                },
                onLoadSuccess: function () {  //加载成功时执行

                },
                onLoadError: function () {  //加载失败时执行
                    layui.use(['layer'], function(){
                        var layer = layui.layer;
                        layer.msg("加载数据失败", { time: 1500, icon: 2 });
                    });
                },
                rowStyle: function (row, index) {
                    var strclass = "";
                    if (row.status==1) {
                        strclass = 'danger';
                    }                
                    else {
                        return {};
                    }
                    return { classes: strclass }
                }
            });
        }
        
        $(document).ready(function () {
            //调用函数，初始化表格
            initTable();
            //点击查询按钮
            $("#search").bind("click", initTable);
            //点击新增按钮
            $("#btnAdd").bind("click", add);
        });
       
        function dateFormat(index, row) {
            if (index == null || index == 0) return;
            var date = new Date(index * 1000);  
            var y = date.getFullYear();    
            var m = date.getMonth() + 1;    
            m = m < 10 ? ('0' + m) : m;    
            var d = date.getDate();    
            d = d < 10 ? ('0' + d) : d;    
            var h = date.getHours();  
            h = h < 10 ? ('0' + h) : h;  
            var minute = date.getMinutes();  
            var second = date.getSeconds();  
            minute = minute < 10 ? ('0' + minute) : minute;    
            second = second < 10 ? ('0' + second) : second;   
            return y + '-' + m + '-' + d+' '+h+':'+minute; 
        }

        function operateFormatter(index, row) {
            var html = "";            
            html += "<a href=\"javascript:edit(" + row.id + ");\"><i class=\"fa fa-edit text-navy\"></i>修改</a>";
            return html;
        }        

        function stateFormat(index, row){
            return index == 0 ? "否" : "是";
        }

        var layer_add_index;        
        function add() {
            layui.use(['layer'], function(){
                var layer = layui.layer;
                layer_add_index = layer.open({
                    type: 2,
                    title: "新增小程序",
                    area:['100%', '100%'],
                    content:"<?php echo url('manager/add'); ?>"
                })
            });
        }                        
        
        var layer_edit_index;
        function edit(id) {
            layui.use(['layer'], function(){
                var layer = layui.layer;
                layer_edit_index = layer.open({
                    type: 2,
                    title: "修改小程序",
                    area:['100%', '100%'],
                    content:"<?php echo url('manager/edit'); ?>?id="+id
                })
            });
        }
    </script>

<!-- Mirrored from www.zi-han.net/theme/hplus/ by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 20 Jan 2016 14:17:11 GMT -->
</html>